/*
 * Copyright (C) 2010-2011 Comcast Cable.  All Rights Reserved.
 */
package com.hercules.android.receiver.model.commands;

import java.util.ArrayList;
import java.util.List;

/**
 * <p>
 * This is a subclass of {@link XRETargetCommand} that represents a CALL XRE command. It defines some properties
 * specific to this command. According to XRE protocol specification, this command is used for calling methods of XRE
 * objects. It is a simple JavaBean (POJO) that provides getters and setters for all private attributes and performs no
 * argument validation in the setters.
 * </p>
 * <p>
 * AndroidAssembly1 this class now extends {@link XRETargetCommand}
 * <p>
 * <strong>Thread safety:</strong> This class is mutable and not thread safe.
 * </p>
 *
 * @author saarixx, jmn
 * @author 7realm
 * @version 1.0
 */
public class XRECallCommand extends XRETargetCommand {

    /**
     * <p>
     * The command name associated with this class.
     * </p>
     * <p>
     * Immutable string constant.
     * </p>
     * <p>
     * Is used in getCommand().
     * </p>
     */
    public static final String COMMAND_NAME = "CALL";

    /**
     * <p>
     * The name of the method to call.
     * </p>
     * <p>
     * Can be any value.
     * </p>
     * <p>
     * Has getter and setter.
     * </p>
     */
    private String method;

    /**
     * <p>
     * The list of objects to be passed to the method as parameters.
     * </p>
     * <p>
     * Can be any value, can contain any values.
     * </p>
     * <p>
     * Has getter and setter.
     * </p>
     */
    private List<Object> params = new ArrayList<Object>();

    /**
     * <p>
     * Creates new instance of {@link XRECallCommand} class.
     * </p>
     */
    public XRECallCommand() {
        // empty constructor
    }

    /**
     * <p>
     * Retrieves the name of this command.
     * </p>
     *
     * @return the name of this command
     */
    @Override
    public String getCommand() {
        return COMMAND_NAME;
    }

    /**
     * <p>
     * Retrieves the name of the method to call.
     * </p>
     *
     * @return the name of the method to call
     */
    public String getMethod() {
        return method;
    }

    /**
     * <p>
     * Sets the name of the method to call.
     * </p>
     *
     * @param method the name of the method to call
     */
    public void setMethod(String method) {
        this.method = method;
    }

    /**
     * <p>
     * Retrieves the list of objects to be passed to the method as parameters.
     * </p>
     *
     * @return the list of objects to be passed to the method as parameters
     */
    public List<Object> getParams() {
        return params;
    }

    /**
     * <p>
     * Sets the list of objects to be passed to the method as parameters.
     * </p>
     *
     * @param params the list of objects to be passed to the method as parameters
     */
    public void setParams(List<Object> params) {
        this.params = params;
    }
}
